﻿Events: on-before-back
        ex:<div template="view" on-before-back="MyCustomBack();"></div>    
        scope.MyCustomBack=function(){
            //do some thing
            return true; //prevent defualt back
        }
        on-topbar-show
        on-topbar-hide
Proerties:      instance        :instance on scope
                caption         :header caption
<body>
    <div class="session-region" ng-transclude style="position:fixed;left:120px;right:0px;top:120px;bottom:0px">
      
    </div>
    
    <script>
        $tmp.$s.$watch(function () {
            return $($tmp.$e[0]).width()
        }, function (n, o) {
            if (angular.isUndefined(n)) return;
            if (n != o) {
              
            }
        });
        $($tmp.$e[0]).find("#header").css("min-height", (120) + "px");
        $($tmp.$e[0]).find("#body").css("min-height", ($(window).height() - 120) + "px");
        $tmp.letfSide = $($tmp.$e[0]).find("#leftSide");
        $tmp.leftCham = $($tmp.$e[0]).find("#leftCham");
        $($tmp.$e[0]).find("#rightSide").css("max-width", $(window).width() - $tmp.letfSide.width() - $tmp.leftCham.width());
        $($tmp.$e[0]).find("#rightSide").css("min-width", $(window).width() - $tmp.letfSide.width() - $tmp.leftCham.width());
        $tmp.leftCham.css("min-height", ($(window).height() - 120) + "px");
        Hammer($($tmp.$e[0])[0]).on("swipe", function (event) {
            if (!$tmp.$IsTopBarShow) {
                $($tmp.$e[0]).find("#topbar").show();
                $tmp.$showBottomBar();
                $tmp.$IsTopBarShow = true;
                if ($tmp.$a.onTopbarShow) {
                    $tmp.$s.$eval($tmp.$a.onTopbarShow);
                    
                }
            }
            else {
                $($tmp.$e[0]).find("#topbar").hide();
                $tmp.$hideBottomBar();
                $tmp.$IsTopBarShow = false;
                if ($tmp.$a.onTopbarHide) {
                    $tmp.$s.$eval($tmp.$a.onTopbarHide);
                   
                }
            }
        }).get('swipe').set({ direction: Hammer.DIRECTION_VERTICAL });;
        $tmp.$s._back = function () {
            if ($tmp.$a.onBeforeBack) {
                var ret = $tmp.$s.$eval($tmp.$a.onBeforeBack);
                if (ret) {
                    return;
                }
            }
            var path = ngW8.$("$application").$getHistory();
            ngW8.$("$loader").$load($tmp.$s.$root, path, function (pScope, ele) {
                pScope.currentInfo = $tmp.$s.currentInfo;
                $("body").html("");
                ele.appendTo($("body")[0]);

            },true);
        };
        $($tmp.$e[0]).mousedown(function (event) {
            if (event.which == 3) {
                if (!$tmp.$IsTopBarShow) {
                    $($tmp.$e[0]).find("#topbar").show();
                    $tmp.$showBottomBar();
                    $tmp.$IsTopBarShow = true;
                    if ($tmp.$a.onTopbarShow) {
                        $tmp.$s.$eval($tmp.$a.onTopbarShow);
                       
                    }
                }
                else {
                    $($tmp.$e[0]).find("#topbar").hide();
                    $tmp.$hideBottomBar();
                    $tmp.$IsTopBarShow = false;
                    if ($tmp.$a.onTopbarHide) {
                        $tmp.$s.$eval($tmp.$a.onTopbarHide);
                       
                    }
                }
            }

        });
        $tmp.$showBottomBar = function () {
            $($tmp.$e[0]).find('[role="bottom-toolbar"]').show();
        }
        $tmp.$hideBottomBar = function () {
            $($tmp.$e[0]).find('[role="bottom-toolbar"]').hide();
        }
        if ($tmp.$a.instance) {
            ngW8.$("$parse")($tmp.$a.instance).assign($tmp.$s, $tmp);
        }
        $tmp.$setHeaderText = function (txt) {
            if (!$tmp.$defaultCaption) {
                $tmp.$defaultCaption = $($tmp.$e[0]).find('[role="session_header_caption"]').html();
            }
            $($tmp.$e[0]).find('[role="session_header_caption"]').html(txt);
        }
        $tmp.$resetHeaderText = function () {
            
            $($tmp.$e[0]).find('[role="session_header_caption"]').html($tmp.$defaultCaption);
        }
        $tmp.$a.$observe("caption", function (v) {
            
            
                $($tmp.$e[0]).find('[role="session_header_caption"]').html(v);
            
        });
        
    </script>
</body>